package com.example.consumer.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class consumer {
    @Autowired
    RedisTemplate redisTemplate;
    final String key="myconfig";

    @GetMapping("/consumer")
    public String consumer(){
        Object value = redisTemplate.opsForValue().get(key);
        if (value==null){
            return "没取到";
        }
        System.out.println(value);
        return value.toString();
    }
}
